#pragma once
#include <boost/noncopyable.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/iostreams/positioning.hpp>

namespace ja2{ namespace vfs
{
	//! Interface for implementing the concrete device.
	class FileDeviceHandle : boost::noncopyable
	{
		// Attributes
	private:
		//! Real file name that is physically opened.
		boost::filesystem::path const m_RealName;
		//! File name (alternative).
		std::string const m_Name;
				
		// Operations
	public:
		//! Read operation.
		virtual std::streamsize read(char *Buffer, std::streamsize Size) = 0;
		//! Write operation.
		virtual std::streamsize write(const char* Buffer, std::streamsize Size) = 0;
		//! Seek operation.
		virtual boost::iostreams::stream_offset seek(boost::iostreams::stream_offset Offset, std::ios_base::seekdir Direction) = 0;
		//! Open device.
		virtual void open(std::ios_base::openmode mode) = 0;
		//! Is device opened.
		virtual bool is_open() const = 0;
		//! Close device.
		virtual void close() = 0;
	protected:
		//! Get real name.
		boost::filesystem::path const &get_real_name() const;

		// Construction/Destruction
	protected:
		//! Constructor for real files.
		FileDeviceHandle(boost::filesystem::path const &RealFileNamePath, std::string const &AlternativeName);
	public:
		virtual ~FileDeviceHandle() = 0 {}
	};
} /*vfs*/} /*ja2*/
